home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 February: Tool Chest / Dev.CD Feb 94.toast / Tool Chest / Development Platforms / MPW Related / MPW Interfaces / PInterfaces / Printing.p < prev    next >
Encoding:
Text File  |  1993-09-17  |  10.2 KB  |  391 lines  |  [TEXT/MPS ]

  1. {
  2.     File:        Printing.p
  3.  
  4.     Copyright:    © 1983-1993 by Apple Computer, Inc.
  5.                 All rights reserved.
  6.  
  7.     Version:    System 7.1 for ETO #11
  8.     Created:    Tuesday, March 30, 1993 18:00
  9.  
  10. }
  11.  
  12. {$IFC UNDEFINED UsingIncludes}
  13. {$SETC UsingIncludes := 0}
  14. {$ENDC}
  15.  
  16. {$IFC NOT UsingIncludes}
  17.  UNIT Printing;
  18.  INTERFACE
  19. {$ENDC}
  20.  
  21. {$IFC UNDEFINED UsingPrinting}
  22. {$SETC UsingPrinting := 1}
  23.  
  24. {$I+}
  25. {$SETC PrintingIncludes := UsingIncludes}
  26. {$SETC UsingIncludes := 1}
  27. {$IFC UNDEFINED UsingQuickdraw}
  28. {$I $$Shell(PInterfaces)Quickdraw.p}
  29. {$ENDC}
  30. {$IFC UNDEFINED UsingDialogs}
  31. {$I $$Shell(PInterfaces)Dialogs.p}
  32. {$ENDC}
  33. {$SETC UsingIncludes := PrintingIncludes}
  34.  
  35. CONST
  36. iPFMaxPgs = 128;
  37. iPrPgFract = 120;                        {Page scale factor. ptPgSize (below) is in units of 1/iPrPgFract}
  38. iPrPgFst = 1;                            {Page range constants}
  39. iPrPgMax = 9999;
  40. iPrRelease = 3;                            {Current version number of the code.}
  41. iPrSavPFil = -1;
  42. iPrAbort = $0080;
  43. iPrDevCtl = 7;                            {The PrDevCtl Proc's ctl number}
  44. lPrReset = $00010000;                    {The PrDevCtl Proc's CParam for reset}
  45. lPrLineFeed = $00030000;
  46. lPrLFStd = $0003FFFF;                    {The PrDevCtl Proc's CParam for std paper advance}
  47. lPrLFSixth = $0003FFFF;
  48. lPrPageEnd = $00020000;                    {The PrDevCtl Proc's CParam for end page}
  49. lPrDocOpen = $00010000;
  50. lPrPageOpen = $00040000;
  51. lPrPageClose = $00020000;
  52. lPrDocClose = $00050000;
  53. iFMgrCtl = 8;                            {The FMgr's Tail-hook Proc's ctl number}
  54. iMscCtl = 9;                            {The FMgr's Tail-hook Proc's ctl number}
  55. iPvtCtl = 10;                            {The FMgr's Tail-hook Proc's ctl number}
  56. iMemFullErr = -108;
  57. iIOAbort = -27;
  58. pPrGlobals = $00000944;                    {The PrVars lo mem area:}
  59. bDraftLoop = 0;
  60. bSpoolLoop = 1;
  61. bUser1Loop = 2;
  62. bUser2Loop = 3;
  63. fNewRunBit = 2;
  64. fHiResOK = 3;
  65. fWeOpenedRF = 4;
  66.  
  67. {Driver constants }
  68. iPrBitsCtl = 4;
  69. lScreenBits = 0;
  70. lPaintBits = 1;
  71. lHiScreenBits = $00000002;                {The Bitmap Print Proc's Screen Bitmap param}
  72. lHiPaintBits = $00000003;                {The Bitmap Print Proc's Paint [sq pix] param}
  73. iPrIOCtl = 5;
  74. iPrEvtCtl = 6;                            {The PrEvent Proc's ctl number}
  75. lPrEvtAll = $0002FFFD;                    {The PrEvent Proc's CParam for the entire screen}
  76. lPrEvtTop = $0001FFFD;                    {The PrEvent Proc's CParam for the top folder}
  77. iPrDrvrRef = -3;
  78. getRslDataOp = 4;
  79. setRslOp = 5;
  80. draftBitsOp = 6;
  81. noDraftBitsOp = 7;
  82. getRotnOp = 8;
  83. NoSuchRsl = 1;
  84. OpNotImpl = 2;                            {the driver doesn't support this opcode}
  85. RgType1 = 1;
  86.  
  87. TYPE
  88. TFeed = (feedCut,feedFanfold,feedMechCut,feedOther);
  89.  
  90. TScan = (scanTB,scanBT,scanLR,scanRL);
  91.  
  92.  
  93. TPRect = ^Rect;                            { A Rect Ptr }
  94. PrIdleProcPtr = ProcPtr;
  95. PItemProcPtr = ProcPtr;
  96.  
  97. TPPrPort = ^TPrPort;
  98. TPrPort = RECORD
  99.  gPort: GrafPort;                        {The Printer's graf port.}
  100.  gProcs: QDProcs;                        {..and its procs}
  101.  lGParam1: LONGINT;                        {16 bytes for private parameter storage.}
  102.  lGParam2: LONGINT;
  103.  lGParam3: LONGINT;
  104.  lGParam4: LONGINT;
  105.  fOurPtr: BOOLEAN;                        {Whether the PrPort allocation was done by us.}
  106.  fOurBits: BOOLEAN;                        {Whether the BitMap allocation was done by us.}
  107.  END;
  108.  
  109. { Printing Graf Port. All printer imaging, whether spooling, banding, etc, happens "thru" a GrafPort.
  110.   This is the "PrPeek" record. }
  111. TPPrInfo = ^TPrInfo;
  112. TPrInfo = RECORD
  113.  iDev: INTEGER;                            {Font mgr/QuickDraw device code}
  114.  iVRes: INTEGER;                        {Resolution of device, in device coordinates}
  115.  iHRes: INTEGER;                        {..note: V before H => compatable with Point.}
  116.  rPage: Rect;                            {The page (printable) rectangle in device coordinates.}
  117.  END;
  118.  
  119. { Print Info Record: The parameters needed for page composition. }
  120. TPPrStl = ^TPrStl;
  121. TPrStl = RECORD
  122.  wDev: INTEGER;
  123.  iPageV: INTEGER;
  124.  iPageH: INTEGER;
  125.  bPort: SignedByte;
  126.  feed: TFeed;
  127.  END;
  128.  
  129. TPPrXInfo = ^TPrXInfo;
  130. TPrXInfo = RECORD
  131.  iRowBytes: INTEGER;
  132.  iBandV: INTEGER;
  133.  iBandH: INTEGER;
  134.  iDevBytes: INTEGER;
  135.  iBands: INTEGER;
  136.  bPatScale: SignedByte;
  137.  bUlThick: SignedByte;
  138.  bUlOffset: SignedByte;
  139.  bUlShadow: SignedByte;
  140.  scan: TScan;
  141.  bXInfoX: SignedByte;
  142.  END;
  143.  
  144. TPPrJob = ^TPrJob;
  145. TPrJob = RECORD
  146.  iFstPage: INTEGER;                        {Page Range.}
  147.  iLstPage: INTEGER;
  148.  iCopies: INTEGER;                        {No. copies.}
  149.  bJDocLoop: SignedByte;                    {The Doc style: Draft, Spool, .., and ..}
  150.  fFromUsr: BOOLEAN;                        {Printing from an User's App (not PrApp) flag}
  151.  pIdleProc: PrIdleProcPtr;                {The Proc called while waiting on IO etc.}
  152.  pFileName: StringPtr;                    {Spool File Name: NIL for default.}
  153.  iFileVol: INTEGER;                        {Spool File vol, set to 0 initially}
  154.  bFileVers: SignedByte;                    {Spool File version, set to 0 initially}
  155.  bJobX: SignedByte;                        {An eXtra byte.}
  156.  END;
  157.  
  158. TPrFlag1 = PACKED RECORD
  159.  f15: BOOLEAN;
  160.  f14: BOOLEAN;
  161.  f13: BOOLEAN;
  162.  f12: BOOLEAN;
  163.  f11: BOOLEAN;
  164.  f10: BOOLEAN;
  165.  f9: BOOLEAN;
  166.  f8: BOOLEAN;
  167.  f7: BOOLEAN;
  168.  f6: BOOLEAN;
  169.  f5: BOOLEAN;
  170.  f4: BOOLEAN;
  171.  f3: BOOLEAN;
  172.  f2: BOOLEAN;
  173.  fLstPgFst: BOOLEAN;
  174.  fUserScale: BOOLEAN;
  175.  END;
  176.  
  177. { Print Job: Print "form" for a single print request. }
  178. TPPrint = ^TPrint;
  179. THPrint = ^TPPrint;
  180. TPrint = RECORD
  181.  iPrVersion: INTEGER;                    {(2) Printing software version}
  182.  prInfo: TPrInfo;                        {(14) the PrInfo data associated with the current style.}
  183.  rPaper: Rect;                            {(8) The paper rectangle [offset from rPage]}
  184.  prStl: TPrStl;                            {(8)  This print request's style.}
  185.  prInfoPT: TPrInfo;                        {(14)  Print Time Imaging metrics}
  186.  prXInfo: TPrXInfo;                        {(16)  Print-time (expanded) Print info record.}
  187.  prJob: TPrJob;                            {(20) The Print Job request (82)  Total of the above; 120-82 = 38 bytes needed to fill 120}
  188.  CASE INTEGER OF
  189.    0:
  190.   (printX: ARRAY [1..19] OF INTEGER);
  191.    1:
  192.   (prFlag1: TPrFlag1;                   {a word of flags}
  193.   iZoomMin: INTEGER;
  194.   iZoomMax: INTEGER;
  195.   hDocName: StringHandle);                 {current doc's name, nil = front window}
  196.  END;
  197.  
  198. { The universal 120 byte printing record }
  199. TPPrStatus = ^TPrStatus;
  200. TPrStatus = RECORD
  201.  iTotPages: INTEGER;                    {Total pages in Print File.}
  202.  iCurPage: INTEGER;                        {Current page number}
  203.  iTotCopies: INTEGER;                    {Total copies requested}
  204.  iCurCopy: INTEGER;                        {Current copy number}
  205.  iTotBands: INTEGER;                    {Total bands per page.}
  206.  iCurBand: INTEGER;                        {Current band number}
  207.  fPgDirty: BOOLEAN;                        {True if current page has been written to.}
  208.  fImaging: BOOLEAN;                        {Set while in band's DrawPic call.}
  209.  hPrint: THPrint;                        {Handle to the active Printer record}
  210.  pPrPort: TPPrPort;                        {Ptr to the active PrPort}
  211.  hPic: PicHandle;                        {Handle to the active Picture}
  212.  END;
  213.  
  214. { Print Status: Print information during printing. }
  215. TPPfPgDir = ^TPfPgDir;
  216. THPfPgDir = ^TPPfPgDir;
  217. TPfPgDir = RECORD
  218.  iPages: INTEGER;
  219.  iPgPos: ARRAY [0..128] OF LONGINT;        {ARRAY [0..iPfMaxPgs] OF LONGINT}
  220.  END;
  221.  
  222. { PicFile = a TPfHeader followed by n QuickDraw Pics (whose PicSize is invalid!) }
  223. TPPrDlg = ^TPrDlg;
  224. TPrDlg = RECORD
  225.  Dlg: DialogRecord;                        {The Dialog window}
  226.  pFltrProc: ModalFilterProcPtr;            {The Filter Proc.}
  227.  pItemProc: PItemProcPtr;                {The Item evaluating proc.}
  228.  hPrintUsr: THPrint;                    {The user's print record.}
  229.  fDoIt: BOOLEAN;
  230.  fDone: BOOLEAN;
  231.  lUser1: LONGINT;                        {Four longs for user's to hang global data.}
  232.  lUser2: LONGINT;                        {...Plus more stuff needed by the particular printing dialog.}
  233.  lUser3: LONGINT;
  234.  lUser4: LONGINT;
  235.  END;
  236.  
  237.  
  238. PDlgInitProcPtr = ProcPtr;
  239.  
  240. TGnlData = RECORD
  241.  iOpCode: INTEGER;
  242.  iError: INTEGER;
  243.  lReserved: LONGINT;                    {more fields here depending on call}
  244.  END;
  245.  
  246. TRslRg = RECORD
  247.  iMin: INTEGER;
  248.  iMax: INTEGER;
  249.  END;
  250.  
  251. TRslRec = RECORD
  252.  iXRsl: INTEGER;
  253.  iYRsl: INTEGER;
  254.  END;
  255.  
  256. TGetRslBlk = RECORD
  257.  iOpCode: INTEGER;
  258.  iError: INTEGER;
  259.  lReserved: LONGINT;
  260.  iRgType: INTEGER;
  261.  xRslRg: TRslRg;
  262.  yRslRg: TRslRg;
  263.  iRslRecCnt: INTEGER;
  264.  rgRslRec: ARRAY [1..27] OF TRslRec;
  265.  END;
  266.  
  267. TSetRslBlk = RECORD
  268.  iOpCode: INTEGER;
  269.  iError: INTEGER;
  270.  lReserved: LONGINT;
  271.  hPrint: THPrint;
  272.  iXRsl: INTEGER;
  273.  iYRsl: INTEGER;
  274.  END;
  275.  
  276. TDftBitsBlk = RECORD
  277.  iOpCode: INTEGER;
  278.  iError: INTEGER;
  279.  lReserved: LONGINT;
  280.  hPrint: THPrint;
  281.  END;
  282.  
  283. TGetRotnBlk = RECORD
  284.  iOpCode: INTEGER;
  285.  iError: INTEGER;
  286.  lReserved: LONGINT;
  287.  hPrint: THPrint;
  288.  fLandscape: BOOLEAN;
  289.  bXtra: SignedByte;
  290.  END;
  291.  
  292. TPBitMap = ^BitMap;                        { A BitMap Ptr }
  293.  
  294. TN = 0..15;                                { a Nibble }
  295.  
  296. TPWord = ^TWord;
  297. THWord = ^TPWord;
  298. TWord = PACKED RECORD
  299.  CASE INTEGER OF
  300.    0:
  301.   (c1,c0: CHAR);
  302.    1:
  303.   (b1,b0: SignedByte);
  304.    2:
  305.   (usb1,usb0: Byte);
  306.    3:
  307.   (n3,n2,n1,n0: TN);
  308.    4:
  309.   (f15,f14,f13,f12,f11,f10,f9,f8,f7,f6,f5,f4,f3,f2,f1,f0: BOOLEAN);
  310.    5:
  311.   (i0: INTEGER);
  312.  END;
  313.  
  314. TPLong = ^TLong;
  315. THLong = ^TPLong;
  316. TLong = RECORD
  317.  CASE INTEGER OF
  318.    0:
  319.   (w1,w0: TWord);
  320.    1:
  321.   (b1,b0: LONGINT);
  322.    2:
  323.   (p0: Ptr);
  324.    3:
  325.   (h0: Handle);
  326.    4:
  327.   (pt: Point);
  328.  END;
  329.  
  330.  
  331. PROCEDURE PrPurge;
  332.  INLINE $2F3C,$A800,$0000,$A8FD;
  333. PROCEDURE PrNoPurge;
  334.  INLINE $2F3C,$B000,$0000,$A8FD;
  335. PROCEDURE PrOpen;
  336.  INLINE $2F3C,$C800,$0000,$A8FD;
  337. PROCEDURE PrClose;
  338.  INLINE $2F3C,$D000,$0000,$A8FD;
  339. PROCEDURE PrintDefault(hPrint: THPrint);
  340.  INLINE $2F3C,$2004,$0480,$A8FD;
  341. FUNCTION PrValidate(hPrint: THPrint): BOOLEAN;
  342.  INLINE $2F3C,$5204,$0498,$A8FD;
  343. FUNCTION PrStlDialog(hPrint: THPrint): BOOLEAN;
  344.  INLINE $2F3C,$2A04,$0484,$A8FD;
  345. FUNCTION PrJobDialog(hPrint: THPrint): BOOLEAN;
  346.  INLINE $2F3C,$3204,$0488,$A8FD;
  347. FUNCTION PrStlInit(hPrint: THPrint): TPPrDlg;
  348.  INLINE $2F3C,$3C04,$040C,$A8FD;
  349. FUNCTION PrJobInit(hPrint: THPrint): TPPrDlg;
  350.  INLINE $2F3C,$4404,$0410,$A8FD;
  351. PROCEDURE PrJobMerge(hPrintSrc: THPrint;hPrintDst: THPrint);
  352.  INLINE $2F3C,$5804,$089C,$A8FD;
  353. FUNCTION PrDlgMain(hPrint: THPrint;pDlgInit: PDlgInitProcPtr): BOOLEAN;
  354.  INLINE $2F3C,$4A04,$0894,$A8FD;
  355. FUNCTION PrOpenDoc(hPrint: THPrint;pPrPort: TPPrPort;pIOBuf: Ptr): TPPrPort;
  356.  INLINE $2F3C,$0400,$0C00,$A8FD;
  357. PROCEDURE PrCloseDoc(pPrPort: TPPrPort);
  358.  INLINE $2F3C,$0800,$0484,$A8FD;
  359. PROCEDURE PrOpenPage(pPrPort: TPPrPort;pPageFrame: TPRect);
  360.  INLINE $2F3C,$1000,$0808,$A8FD;
  361. PROCEDURE PrClosePage(pPrPort: TPPrPort);
  362.  INLINE $2F3C,$1800,$040C,$A8FD;
  363. PROCEDURE PrPicFile(hPrint: THPrint;pPrPort: TPPrPort;pIOBuf: Ptr;pDevBuf: Ptr;
  364.  VAR prStatus: TPrStatus);
  365.  INLINE $2F3C,$6005,$1480,$A8FD;
  366. FUNCTION PrError: INTEGER;
  367.  INLINE $2F3C,$BA00,$0000,$A8FD;
  368. PROCEDURE PrSetError(iErr: INTEGER);
  369.  INLINE $2F3C,$C000,$0200,$A8FD;
  370. PROCEDURE PrGeneral(pData: Ptr);
  371.  INLINE $2F3C,$7007,$0480,$A8FD;
  372. PROCEDURE PrDrvrOpen;
  373.  INLINE $2F3C,$8000,$0000,$A8FD;
  374. PROCEDURE PrDrvrClose;
  375.  INLINE $2F3C,$8800,$0000,$A8FD;
  376. PROCEDURE PrCtlCall(iWhichCtl: INTEGER;lParam1: LONGINT;lParam2: LONGINT;
  377.  lParam3: LONGINT);
  378.  INLINE $2F3C,$A000,$0E00,$A8FD;
  379. FUNCTION PrDrvrDCE: Handle;
  380.  INLINE $2F3C,$9400,$0000,$A8FD;
  381. FUNCTION PrDrvrVers: INTEGER;
  382.  INLINE $2F3C,$9A00,$0000,$A8FD;
  383.  
  384.  
  385. {$ENDC} { UsingPrinting }
  386.  
  387. {$IFC NOT UsingIncludes}
  388.  END.
  389. {$ENDC}
  390.  
  391.